package io.geekidea.boot.shop.controller.app;

import io.geekidea.boot.framework.page.Paging;
import io.geekidea.boot.framework.response.ApiResult;
import io.geekidea.boot.shop.query.app.AppOrderDetailQuery;
import io.geekidea.boot.shop.service.base.api.OrderDetailService;
import io.geekidea.boot.shop.vo.app.AppOrderDetailVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * Appnull 控制器
 *
 * @author geekidea
 * @since 2024-10-27
 */
@Slf4j
@RestController
@Tag(name = "Appnull")
@RequestMapping("/app/orderDetail")
public class AppOrderDetailController {

    @Autowired
    private OrderDetailService orderDetailService;

    /**
     * 获取Appnull详情
     *
     * @param id
     * @return
     * @throws Exception
     */
    @Operation(summary = "获取Appnull详情")
    @PostMapping("/getAppOrderDetail/{id}")
    public ApiResult<AppOrderDetailVo> getAppOrderDetail(@PathVariable Integer id) {
        log.info("获取Appnull详情：{}", id);
        AppOrderDetailVo appOrderDetailVo = orderDetailService.getAppOrderDetailById(id);
        return ApiResult.success(appOrderDetailVo);
    }

    /**
     * 获取Appnull分页列表
     *
     * query
     * @return
     * @throws Exception
     */
    @Operation(summary = "获取Appnull分页列表")
    @PostMapping("/getAppOrderDetailPage")
    public ApiResult<AppOrderDetailVo> getAppOrderDetailPage(@Valid @RequestBody AppOrderDetailQuery query) {
        log.info("获取Appnull分页列表：{}", query);
        Paging<AppOrderDetailVo> paging = orderDetailService.getAppOrderDetailPage(query);
        return ApiResult.success(paging);
    }

}
